Page({
  chooseImage() {
    //拍照或从手机相册中选择图片
    my.chooseImage({
      sourceType: ['camera','album'],
      //相册或拍照选取
      count: 2,//最大可选照片数
      success: (res) => {
        my.alert({
          content: JSON.stringify(res),
          //res.apFilePaths[0];图片的路径地址
        });
      },
      fail:()=>{
        my.showToast({
          content: 'fail', // 文字内容
        });
      }
    })
  },
  previewImage() {
    //预览图片
    my.previewImage({
      current: 2,//当前显示的图片索引
      //图片链接列表
      urls: [
        'https://img.alicdn.com/tps/TB1sXGYIFXXXXc5XpXXXXXXXXXX.jpg',
        'https://img.alicdn.com/tps/TB1pfG4IFXXXXc6XXXXXXXXXXXX.jpg',
        'https://img.alicdn.com/tps/TB1h9xxIFXXXXbKXXXXXXXXXXXX.jpg'
      ],
    });
  },
  saveImage() {
        //保存图片到手机相册
        my.saveImage({
        url: 'https://img.alicdn.com/tps/TB1sXGYIFXXXXc5XpXXXXXXXXXX.jpg',
        showActionSheet: true,//显示图片操作菜单
        success: () => {
            my.alert({
            title: '保存成功',
            });
        },
        });
    },
    getImageInfo(){
        my.getImageInfo({
            src:'image/redBag.png',
            success:(res)=>{
                console.log(JSON.stringify(res))
                my.alert({title:JSON.stringify(res)})
            }
        })
    }
});